/**
 * Created by Feng on 2017/2/15.
 */
new Vue({
    el:".container",
    data:{
        resultJson:[],
        limitNum:3,
        currentIndex:0,
        checkout:1
    },
    mounted:function () {
        this.$nextTick(function () {
            this.getAddressList();
        });
    },
    computed:{
        //界面显示3条数据
        filterAddress:function () {
            return this.resultJson.slice(0,this.limitNum);
        }
    },
    methods: {
        getAddressList:function () {
            var _this = this;
            this.$http.get("data/address.json").then(function (json) {
                var res = json.body;
                if (res.status == "1"){
                    _this.resultJson = res.result;
                }
            })
        },
        //点击更多More
        loadMore:function () {
            this.limitNum = this.resultJson.lentgh;
        },
        delDefault:function (addressId) {
            this.resultJson.forEach(function (item,index) {
                if (item.addressId == addressId){
                    item.isDefault = true;
                }else {
                    item.isDefault = false;
                }
            })
        }
    }
})